# -*- coding:utf-8 -*-
# @FileName  :t16.py
# @Time      :2021/7/15 16:03
import io
import sys
import execjs
import requests

sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030')


def jie():
    with open('t2.js', 'r', encoding='gbk') as f:
        jstext = f.read()
    ctx = execjs.compile(jstext)
    result = ctx.call('vv')
    return result


def main(m, f):
    global num
    kv = {'User-Agent': 'yuanrenxue.project', 'cookie': 'sessionid=mr5k2c3zqzljsb7lhwqg7ojdnktcnqtm;m=' + jie()}
    r = requests.get(f'https://match.yuanrenxue.com/api/match/2?page={f}', headers=kv).json()
    print(r)
    for i in r['data']:
        num += i['value']


if __name__ == "__main__":
    num = 0
    # print(jie())
    for i in range(1, 6):
        main(jie(), i)
    print(num)
